package cn.dkk.create_design.factory.coffeeBefor;

import cn.dkk.create_design.factory.pojo.AmericanCoffee;
import cn.dkk.create_design.factory.pojo.parent.Coffee;
import cn.dkk.create_design.factory.pojo.LatteCoffee;

public class CoffeeFactory {

    public static Coffee orderCoffee(String name){
        Coffee coffee=null;
        if ("latte".equals(name)){
            coffee=new LatteCoffee();
        }else if ("american".equals(name)){
            coffee=new AmericanCoffee();
        }else {
            throw new RuntimeException("对不起没有该种咖啡");
        }
        coffee.addSugger();
        coffee.addMilk();
        return coffee;
    }

}
